<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>客户信息</title>
    <link rel="stylesheet" href="__PUBLIC__/css/style.css">
    <link rel="stylesheet" href="__PUBLIC__/ele/index.css">
</head>
<body>
<div id="app" v-cloak>
    <div class="main" v-loading="loading">
        <div class="header">
            <el-menu default-active="2" mode="horizontal" background-color="#545c64" @select="changeMenu"
                     text-color="#fff" active-text-color="#ffd04b">
                <el-menu-item index="1">Dashboard</el-menu-item>
                <el-menu-item index="2">客户信息</el-menu-item>
                <div class="user-tools">
                    <el-dropdown trigger="click" @command="handleCommand">
                      <span class="el-dropdown-link">
                        管理员<i class="el-icon-arrow-down el-icon--right"></i>
                      </span>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item command="edit">修改密码</el-dropdown-item>
                            <el-dropdown-item command="loginout">注销登陆</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </div>
            </el-menu>
        </div>
        <div class="content">
            <el-row>
                <el-form :inline="true">
                    <el-col :xs="24" :sm="24" :md="5" :lg="5" :xl="5">
                        <el-form-item label="选择城市">
                            <el-select v-model="query.province" placeholder="选择客户城市" size="mini">
                                <el-option
                                        v-for="item in Object.values(provinceData)"
                                        :key="item"
                                        :label="item"
                                        :value="item">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="5" :lg="5" :xl="5">
                        <el-form-item label="开始时间">
                            <el-date-picker v-model="query.startDate" type="date" value-format="yyyy-MM-dd" size="mini"
                                            placeholder="查询开始时间"></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="5" :lg="5" :xl="5">
                        <el-form-item label="结束时间">
                            <el-date-picker v-model="query.endDate" type="date" value-format="yyyy-MM-dd" size="mini"
                                            placeholder="查询结束时间"></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="24" :md="5" :lg="5" :xl="5">
                        <el-form-item label-width="0">
                            <el-button type="primary" size="mini" @click="restQuery">重置</el-button>
                            <el-button type="primary" size="mini" @click="getData(1)">查询</el-button>
                        </el-form-item>
                    </el-col>
                </el-form>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-table :data="tableData" style="width: 100%">
                        <el-table-column type="index" label="序号"></el-table-column>
                        <el-table-column prop="name" label="用户姓名"></el-table-column>
                        <el-table-column prop="mobile" label="手机号"></el-table-column>
                        <el-table-column prop="province" label="省"></el-table-column>
                        <el-table-column prop="shopArea" label="店铺地区"></el-table-column>
                        <el-table-column prop="shopName" label="店铺名称"></el-table-column>
                        <el-table-column prop="shopTel" label="店铺联系方式"></el-table-column>
                        <el-table-column prop="regTime" label="提交时间"></el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <div class="page-wrap" v-if="query.totalSize>0">
                <el-pagination background layout="prev, pager, next" :total="query.totalSize"
                               @current-change=changePage></el-pagination>
            </div>
        </div>
    </div>
    <!--修改密码-->
    <el-dialog title="修改密码" :visible.sync="editPassBox" width="400px" center>
        <span>
            <el-form label-width="80px">
              <el-form-item label="旧密码">
                <el-input v-model="edit.oldpass" size="mini"></el-input>
              </el-form-item>
              <el-form-item label="新密码">
                <el-input v-model="edit.newpass" size="mini"></el-input>
              </el-form-item>
              <el-form-item label="重复密码">
                <el-input v-model="edit.repass" size="mini"></el-input>
              </el-form-item>
            </el-form>
        </span>
        <span slot="footer" class="dialog-footer">
    <el-button @click="editPassBox = false" size="mini">取 消</el-button>
    <el-button type="primary" @click="editPassSubmit" size="mini">确 认 修 改</el-button>
  </span>
    </el-dialog>
</div>
<script src="__PUBLIC__/js/vue.js" type="text/javascript"></script>
<script src="__PUBLIC__/js/babel.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/js/babel-polyfill.js" type="text/javascript"></script>
<script src="__PUBLIC__/js/jquery-3.3.1.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/ele/index.js" type="text/javascript"></script>
<script type="text/babel">
    var app = new Vue({
        el: "#app",
        data: function () {
            return {
                query: {
                    province: "",
                    startDate: "",
                    endDate: "",
                    page: 1,
                    totalSize: 0,
                    pageSize:50
                },
                provinceData:{
                    110000: '北京市',
                    120000: '天津市',
                    130000: '河北省',
                    140000: '山西省',
                    150000: '内蒙古自治区',
                    210000: '辽宁省',
                    220000: '吉林省',
                    230000: '黑龙江省',
                    310000: '上海市',
                    320000: '江苏省',
                    330000: '浙江省',
                    340000: '安徽省',
                    350000: '福建省',
                    360000: '江西省',
                    370000: '山东省',
                    410000: '河南省',
                    420000: '湖北省',
                    430000: '湖南省',
                    440000: '广东省',
                    450000: '广西壮族自治区',
                    460000: '海南省',
                    500000: '重庆市',
                    510000: '四川省',
                    520000: '贵州省',
                    530000: '云南省',
                    540000: '西藏自治区',
                    610000: '陕西省',
                    620000: '甘肃省',
                    630000: '青海省',
                    640000: '宁夏回族自治区',
                    650000: '新疆维吾尔自治区',
                    710000: '台湾省',
                    810000: '香港特别行政区',
                    820000: '澳门特别行政区'
                },
                tableData: [],
                editPassBox: false,
                edit: {
                    oldpass: "",
                    newpass: "",
                    repass: "",
                },
                btnLoding: false,
                loading: false
            }
        },
        methods: {
            editPassSubmit: function () {
                var that = this
                this.btnLoding = true
                $.ajax({
                    url: "./editPass",
                    type: 'post',
                    data: that.edit,
                    success: function (res) {
                        if (res.code == 200) {
                            that.btnLoding = false;
                            location.href = res.redirect
                        } else {
                            alert(res.msg)
                            that.btnLoding = false;
                        }
                    }
                })
            },
            handleCommand: function (command) {
                if (command == 'edit') {
                    this.editPassBox = !this.editPassBox
                } else if (command == 'loginout') {
                    this.$confirm('确认退出系统么？')
                        .then(_ => {
                            location.href = "{:url('admin/index/loginout')}"
                        })
                        .catch(_ => {
                        });
                }
            },
            changeMenu: function (val) {
                if (val == 1) {
                    location.href = "{:url('admin/index/index')}"
                } else if (val == 2) {
                    location.href = "{:url('admin/index/consumer')}"
                }
            },
            changePage: function (page) {
                this.query.page = page
                this.getData(0)
            },
            getData: function (type) {
                var that = this
                if(type==0){
                    var parmas = {
                        "page": this.query.page,
                        "pageSize": this.query.pageSize,
                        "startDate": this.query.startDate,
                        "endDate": this.query.endDate,
                        "province": this.query.province
                    }
                }else{
                    var parmas = {
                        "page": 1,
                        "pageSize": this.query.pageSize,
                        "startDate": this.query.startDate,
                        "endDate": this.query.endDate,
                        "province": this.query.province
                    }
                }
                var shopLists={'1': {'id': '1', 'name': '陈程', 'area': '西安', 'sheng': '陕西', 'shi': '西安', 'shopname': '西安太白立交红星店', 'shoptype': '森语', 'address': '陕西省西安市碑林区太白北路1号负一层', 'fax': ' -', 'mobile': '17868880332'}, '2': {'id': '2', 'name': '张晓峰', 'area': '渭南', 'sheng': '陕西', 'shi': '渭南', 'shopname': '渭南居然之家店', 'shoptype': '森语', 'address': '陕西省渭南市东风大街居然之家一层', 'tel': '029-65693130', 'fax': ' -', 'mobile': '13991233808'}, '3': {'id': '3', 'name': '邹斌', 'area': '安康', 'sheng': '陕西', 'shi': '安康', 'shopname': '天贸城店', 'shoptype': '森语', 'address': '陕西省安康市高新区天贸城6区二层', 'mobile': '18091535178'}, '4': {'id': '4', 'name': '丁然', 'area': '兰州', 'sheng': '甘肃', 'shi': '兰州', 'shopname': '兰州红星美凯龙', 'shoptype': '森语', 'address': '甘肃省兰州市城关区红星美凯龙家居一层A8059', 'tel': '09318503183', 'fax': '09318503183', 'mobile': '13919822799'}, '5': {'id': '5', 'name': '丁然', 'area': '兰州', 'sheng': '甘肃', 'shi': '兰州', 'shopname': '兰州居然之家', 'shoptype': '森语', 'address': '甘肃省兰州市城关区城关区雁北路居然之家一层', 'mobile': '13919822799'}, '6': {'id': '6', 'name': '詹敏', 'area': '银川', 'sheng': '宁夏', 'shi': '银川', 'shopname': '银川月星家居广场', 'shoptype': '森语', 'address': '宁夏银川市兴庆区新华东街和丽景南街交叉口东北角月星家居广场二楼', 'mobile': '15719595533'}, '7': {'id': '7', 'name': '王明福', 'area': '成都', 'sheng': '四川', 'shi': '成都', 'shopname': '成都首信红星店', 'shoptype': '森语', 'address': '成都市武侯区智谷大道与七里路交汇处首信红星美凯龙二层', 'tel': ' 028-86180109/86782617', 'fax': '028-86782617*802', 'mobile': '15928519987'}, '8': {'id': '8', 'name': '幸继承', 'area': '贵阳', 'sheng': '贵州', 'shi': '贵阳', 'shopname': '北京西路红星美凯龙', 'shoptype': '森语', 'address': '贵阳北京西路红星美凯龙二层', 'mobile': '13984030963'}, '9': {'id': '9', 'name': '杨良文', 'area': '重庆', 'sheng': '重庆', 'shi': '重庆', 'shopname': '居然之家金源店', 'shoptype': '森语', 'address': '重庆市江北区北滨路368号居然之家重庆金源店DS6-W-3001B', 'tel': '023-86830399', 'fax': '023-86830399', 'mobile': '13320227996'}, '10': {'id': '10', 'name': '杨良文', 'area': '重庆', 'sheng': '重庆', 'shi': '重庆', 'shopname': '居然之家聚信店', 'shoptype': '森语', 'address': '重庆市渝北区红石大道150号居然之家聚信店A-2013', 'mobile': '13320227996'}, '11': {'id': '11', 'name': '杨良文', 'area': '重庆', 'sheng': '重庆', 'shi': '重庆', 'shopname': '红星美凯龙茶园店', 'shoptype': '森语', 'address': '重庆市南岸区玉马路红星美凯龙三层', 'mobile': '13320227996'}, '12': {'id': '12', 'name': '张莹', 'area': '蚌埠', 'sheng': '安徽', 'shi': '蚌埠', 'shopname': '蚌埠光彩大市场店', 'shoptype': '森语', 'address': '安徽省蚌埠市光彩大市场4区8幢101室', 'tel': '0552-7287888', 'fax': ' -', 'mobile': '18655270688'}, '13': {'id': '13', 'name': '于海苗', 'area': '上海市区（除嘉定、松江、青浦、奉贤、金山、崇明外）', 'sheng': '上海', 'shi': '上海', 'shopname': '真北路红星美凯龙', 'shoptype': '森语', 'address': '上海市普陀区真北路1108号红星美凯龙负一层G8266', 'tel': '021-32510458', 'mobile': '18616160599'}, '14': {'id': '14', 'name': '于海苗', 'area': '上海市区（除嘉定、松江、青浦、奉贤、金山、崇明外）', 'sheng': '上海', 'shi': '上海', 'shopname': '上海家饰佳店', 'shoptype': '森语', 'address': '上海市徐汇区中山西路1695号家饰佳国际馆2楼G2062', 'tel': '021-64388906', 'fax': '021-64388906', 'mobile': '18616160599'}, '15': {'id': '15', 'name': '黄应军', 'area': '长沙', 'sheng': '湖南', 'shi': '长沙', 'shopname': '长沙欧亚达店', 'shoptype': '森语', 'address': '湖南省长沙市雨花区万家丽路与劳动路交界处欧亚达建材家居广场二楼F2-B2-11', 'tel': '0731-89704011', 'fax': ' -', 'mobile': '13807313466'}, '16': {'id': '16', 'name': '吴翀', 'area': '合肥', 'sheng': '安徽', 'shi': '合肥', 'shopname': '合肥长江东路居然之家', 'shoptype': '森语', 'address': '安徽省合肥市长江东路居然之家C区一层', 'tel': '0551-67756605', 'fax': '0551-64499276（吴）  0551-67756607（万）', 'mobile': '13721023197'}, '17': {'id': '17', 'name': '葛志远', 'area': '青岛', 'sheng': '山东', 'shi': '青岛', 'shopname': '开发区海博', 'shoptype': '森语', 'address': '山东省青岛市开发区海博家居广场208展厅', 'tel': '0532-85621860', 'fax': '0532-85621860', 'mobile': '18053215776'}, '18': {'id': '18', 'name': '田敏', 'area': '长春', 'sheng': '吉林', 'shi': '长春', 'shopname': '居然之家太阳城店', 'shoptype': '森语', 'address': '长春市宽城区杭州路居然之家太阳城店15号门地板区DS99-2-1-D012', 'mobile': '18166846279'}, '19': {'id': '19', 'name': '秦洪涛', 'area': '沈阳', 'sheng': '辽宁', 'shi': '沈阳', 'shopname': '沈阳铁西红星美凯龙', 'shoptype': '森语', 'address': '辽宁省沈阳市铁西区新华北街北二路红星美凯龙家居馆三楼G—3031', 'tel': '024—85637683', 'fax': '024—85637683', 'mobile': '13804993066'}, '21': {'id': '21', 'name': '林绪文', 'area': '济南', 'sheng': '山东', 'shi': '济南', 'shopname': '济南星艺佳', 'shoptype': '森语', 'address': '济南市天桥区小清河北路188-1号星艺佳家居生活广场东厅A座3楼', 'mobile': '18678875845'}, '22': {'id': '22', 'name': '吴道静', 'area': '烟台', 'sheng': '山东', 'shi': '烟台', 'shopname': '莱山区永盛建材城', 'shoptype': '森语', 'address': '山东省烟台市芝罘区通洋路39号(近九隆街)嘉禾乐天家居广场一楼博文家居体验馆', 'tel': '0535-2116225', 'fax': '0535-2116225', 'mobile': '13361385739'}, '23': {'id': '23', 'name': '王建伟', 'area': '武汉', 'sheng': '湖北', 'shi': '武汉', 'shopname': '武汉欧亚达建材市场', 'shoptype': '森语', 'address': '湖北省武汉市武昌区徐东大街38号欧亚达建材家居广场徐东店2楼B3-06', 'tel': '027-86619799', 'mobile': '13871192661'}, '24': {'id': '24', 'name': '朱红海', 'area': '上海郊区（嘉定、松江、青浦、奉贤、金山、崇明）', 'sheng': '上海', 'shi': '上海', 'shopname': '南桥南港路店', 'shoptype': '森语', 'address': '上海市奉贤区南桥镇南港路1533号', 'tel': '021-37522066', 'fax': ' -', 'mobile': '13916028807'}, '25': {'id': '25', 'name': '陶富德', 'area': '江苏盐城', 'sheng': '江苏', 'shi': '盐城', 'shopname': '红星美凯龙', 'shoptype': '森语', 'address': '江苏省盐城市红星美凯龙', 'tel': '13961992236', 'fax': ' -', 'mobile': '13961992236'}, '26': {'id': '26', 'name': '何兵', 'area': '深圳', 'sheng': '深圳', 'shi': '深圳', 'shopname': '八卦路沿街店', 'shoptype': '森语', 'address': '深圳市八卦路411栋首层', 'tel': '13823555077', 'fax': ' -', 'mobile': '13823555077'}, '27': {'id': '27', 'name': '余军', 'area': '宁波', 'sheng': '浙江', 'shi': '宁波', 'shopname': '宁波市北仑区小港森雨建材商行', 'shoptype': '森语', 'address': '宁波华生国际家居广场三层(江南公路1666号)', 'tel': '15250832111', 'mobile': '15250832111'}, '28': {'id': '28', 'name': '余军', 'area': '宁波二店', 'sheng': '浙江', 'shi': '宁波', 'shopname': '第六空间', 'shoptype': '森语', 'address': '宁波环城西路北段439号，第六空间国际家居馆二层', 'tel': '\u202d139 0661 1848\u202c', 'mobile': '139 0661 1848\u202c'}, '29': {'id': '29', 'name': '黄永辉\u202d', 'area': '常州', 'sheng': '江苏', 'shi': '常州', 'shopname': '红星美凯龙金坛店', 'shoptype': '森语', 'address': '常州市开发区南环二路金湖路金坛汽车城上汽大众对面红星美凯龙二层', 'mobile': '137 7689 3198\u202c'}, '30': {'id': '30', 'name': '黄永辉\u202d', 'area': '常州', 'sheng': '江苏', 'shi': '常州', 'shopname': '红星美凯龙天宁店', 'shoptype': '森语', 'address': '常州市天宁区飞龙东路68号红星美凯龙三层', 'mobile': '137 7689 3198\u202c'}, '31': {'id': '31', 'name': '骆团委', 'area': '长兴', 'sheng': '浙江', 'shi': '长兴', 'shopname': '长兴波涛装饰工程有限公司', 'shoptype': '森语', 'address': '浙江省长兴市解放西路192.198号', 'tel': '0572-6598875', 'fax': '0572-6598875', 'mobile': '15167286466'}}
                $.ajax({
                    url: "./consumerInfo",
                    type: 'post',
                    data: parmas,
                    success: function (res) {
                        if (res.code == 200) {
                            that.query.totalSize = res.totalSize;
                            for(var i=0;i<res.data.length;i++){
                                if(res.data[i]["shop"]){
                                    var shopId=res.data[i]["shop"]
                                    res.data[i]["shopArea"]=shopLists[shopId]["area"]
                                    res.data[i]["shopName"]=shopLists[shopId]["shopname"]
                                    res.data[i]["shopTel"]=shopLists[shopId]["mobile"]
                                }
                            }
                            that.tableData = res.data;
                            that.loading = false
                        } else {
                            alert(res.msg)
                            that.loading = false
                        }
                    }
                })
            },
            restQuery:function () {
                this.query.page=1
                this.query.province=""
                this.query.startDate=""
                this.query.endDate=""
                this.getData(0)
            }
        },
        created: function () {
            this.getData()
        },
        mounted: function () {

        }
    })
</script>
</body>
</html>
